package com.base.controller.bds;

import com.alibaba.fastjson.JSONObject;
import com.base.api.bds.BdsClinicService;
import com.base.vo.bds.BdsClinicPageHelper;
import com.base.vo.bds.BdsCodeTable;
import com.base.vo.bds.BdsCodeTableItem;
import com.base.vo.bds.BdsOrganization;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/bds", produces = "application/json;charset=UTF-8")
public class bdsController {

    @Autowired
    private BdsClinicService bdsClinicService;

    @GetMapping(value = "/getBdsClinicItemListByInputCode")
    public String getBdsClinicItemListByInputCode(BdsClinicPageHelper bdsClinicPageHelper) {
        return bdsClinicService.getBdsClinicItemListByInputCode(bdsClinicPageHelper);
    }

    @GetMapping(value = "/getBdsOrganization")
    public String getBdsOrganization() {
        return bdsClinicService.getBdsOrganization();
    }

    @GetMapping(value = "/getBdsOrganizationInUum")
    public String getBdsOrganizationInUum() {
        return JSONObject.toJSONString(bdsClinicService.getBdsOrganizationInUum());
    }

    @GetMapping(value = "/getBdsOrganizationByKeyWords")
    public String getBdsOrganizationByKeyWords(String keyWords) {
        return bdsClinicService.getBdsOrganizationByKeyWords(keyWords);
    }

    @GetMapping(value = "/getBdsOrganizationJson")
    public String getBdsOrganizationJson() {
        return bdsClinicService.getBdsOrganizationTreeJson();
    }

    @PostMapping(value = "/saveBdsOrganization")
    public String saveBdsOrganization(BdsOrganization bdsOrganization) {
        return bdsClinicService.saveBdsOrganization(bdsOrganization);
    }

    @PostMapping(value = "/delBdsOrganization")
    public String delBdsOrganization(Integer id) {
        return bdsClinicService.delBdsOrganization(id);
    }

    @GetMapping(value = "/getBdsCodeTable")
    public String getBdsCodeTable(String keyWords) {
        return bdsClinicService.getBdsCodeTable(keyWords);
    }

    @GetMapping(value = "/getBdsCodeTableItem")
    public String getBdsCodeTableItem(Integer tId,String keyWords) {
        return bdsClinicService.getBdsCodeTableItem(tId,keyWords);
    }

    @PostMapping(value = "/enabledTableItem")
    public String enabledTableItem(BdsCodeTableItem bdsCodeTableItem) {
        return bdsClinicService.enabledTableItem(bdsCodeTableItem);
    }

    @PostMapping(value = "/saveBdsCodeTable")
    public String saveBdsCodeTable(BdsCodeTable bdsCodeTable) {
        return bdsClinicService.saveBdsCodeTable(bdsCodeTable);
    }

    @PostMapping(value = "/saveBdsCodeTableItem")
    public String saveBdsCodeTableItem(BdsCodeTableItem bdsCodeTableItem) {
        return bdsClinicService.saveBdsCodeTableItem(bdsCodeTableItem);
    }

    @PostMapping(value = "/delCodeTable")
    public String delCodeTable(Integer id) {
        return bdsClinicService.delCodeTableById(id);
    }

    @PostMapping(value = "/delCodeTableItem")
    public String delCodeTableItem(Integer id) {
        return bdsClinicService.delCodeTableItemById(id);
    }

    @GetMapping(value = "/getTableCodeItemByStandardCode")
    public String getTableCodeItemByStandardCode(String standardCode) {
        return bdsClinicService.getTableCodeItemByStandardCode(standardCode);
    }

}
